﻿using System.Collections;
using UnityEngine;
using XLua;

namespace GameCore
{
    public class Boot : MonoBehaviour
    {
        public static Boot Instance { get; private set; }
        
        private void Awake()
        {
            Instance = this;
            DontDestroyOnLoad(this.gameObject);
        }
        
        private IEnumerator Start()
        {
            yield return new WaitUntil(() =>
            {
                return AssetsManager.Instance != null 
                       && UIManager.Instance != null 
                       && CoroutineManager.Instance != null 
                       && GameObjectPool.Instance != null
                       && Scheduler.Instance != null;
            });
            string cmd = "require('Core.Global'); require('Boot');";
            ProjectLuaEnv.Instance.DoString(cmd);
        }

        private void Test()
        {
            
        }
    }
}